let arr = [6, 5, 3, 4, 8, 4, 6];
let result = arr.filter(value => {
  return value > 5;
});
console.log(result); // [ 6, 8, 6 ]
result = arr.filter(value => {
  return value < 10;
});
console.log(result); // [ 6, 5, 3, 4, 8, 4, 6 ]

let objArr = [
  { name: 'zg', age: 18 },
  { name: 'kobe', age: 19 },
  { name: 'lucy', age: 25 },
  { name: 'jam', age: 33 },
];
result = objArr.filter(item => {
  return item.age > 20;
});
console.log(result);
/**结果
[
  { "name": "lucy", "age": 25 },
  { "name": "jam", "age": 33 }
]
*/
result = objArr.filter(item => {
  return item.age < 26;
});
console.log(result);
/**结果
[
  { "name": "zg", "age": 18 },
  { "name": "kobe", "age": 19 },
  { "name": "lucy", "age": 25 }
]
*/
